package servlet;

import entity.PersonalFile;
import service.PersonalFileService;
import service.PersonalFileServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;

/**
 * @author 孙亚梅
 * @version V1.0
 * @Project javase2203
 * @Package servlet
 * @Description:
 * @Date 2022/5/27 15:02
 *
 * */
 @WebServlet("/updatePersonalFile")
public class updateServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");


        //获取请求参数
        String id= request.getParameter("id");
        String name = request.getParameter("name");
        String birthday = request.getParameter("birthday");
        String gender = request.getParameter("gender");
        String career = request.getParameter("career");
        String address = request.getParameter("address");
        String mobile = request.getParameter("mobile");
        String picture = request.getParameter("picture");


        PersonalFile personalFile = new PersonalFile(id, name,birthday, gender,  career, address,mobile,picture);

        PersonalFileService personalFileService = new PersonalFileServiceImpl();

        personalFileService.updatePersonalFile(personalFile);
        response.sendRedirect(request.getContextPath() + "/PersonalFileList");

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}


